<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <title>左侧导航栏</title>
  <link rel="stylesheet" type="text/css">
  <style>
    .sidebar {
      height: 100%;
      width: 0;
      position: fixed;
      z-index: 1;
      top: 0;
      left: 0;
      background-color: #111;
      overflow-x: hidden;
      padding-top: 60px;
      transition: 0.5s;
    }

    .sidebar .openbtn {
      font-size: 30px;
      cursor: pointer;
      background-color: #111;
      color: #fff;
      border: none;
      margin-left: 20px;
    }

    .sidebar a {
      padding: 8px 8px 8px 32px;
      text-decoration: none;
      font-size: 25px;
      color: #818181;
      display: block;
      transition: 0.3s;
    }

    .sidebar a:hover {
      color: #f1f1f1;
    }

    .main-content {
      margin-left: 0;
      transition: 0.5s;
    }

    .sidenav.active {
      width: 250px;
    }

    .sidenav.active .openbtn {
      margin-left: 240px;
    }

    .sidenav.active .main-content {
      margin-left: 250px;
    }


  </style>

  <script>
    function toggleNav() {
      var sidenav = document.getElementById("sidenav");
      sidenav.classList.toggle("active");
    }
  </script>
</head>
<body>
<div class="sidebar">
  <button class="openbtn" onclick="toggleNav()">☰</button>
  <nav class="sidenav" id="sidenav">
    <a href="#">首页</a>
    <a href="#">关于我们</a>
    <a href="#">产品</a>
    <a href="#">联系我们</a>
  </nav>
  <div class="main-content">
    <!-- 这里是你的页面内容 -->
  </div>
</div>
</body>
</html>